//
//  AllenMyViewController.m
//  自做商城项目
//
//  Created by allenL on 2017/6/20.
//  Copyright © 2017年 tam. All rights reserved.
//

#import "AllenMyViewController.h"
#import "AllenMyMessageTableView.h"//我的页面展示功能的tableView
#import "AllenMyMessageTableViewCell.h"//列表中自定义cell
#import "AllenMyMessageHeaderView.h"//我的页面tableView顶部展示注册登录的view
#import "AllenLandingViewController.h"//注册页面

/*--
 顶部登陆与注册
 --AllenL*/
@interface AllenMyViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (strong , nonatomic) AllenMyMessageHeaderView *headView;
@property (strong , nonatomic) AllenMyMessageTableView *messageTable;

@end

@implementation AllenMyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.edgesForExtendedLayout = 0;
    self.view.backgroundColor = MainColor;
    [self.view addSubview:self.headView];
    [self.view addSubview:self.messageTable];
    [self addAutoLayout];
}

- (void)addAutoLayout{
    __weak typeof (self) weakSelf = self;
    //对顶部登陆注册添加约束
    [_headView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(150);
    }];
    //给tableview添加约束
    [_messageTable mas_makeConstraints:^(MASConstraintMaker *make){
        make.left.right.equalTo(weakSelf.view);
        make.height.mas_equalTo(176);
        make.top.equalTo(weakSelf.headView.mas_bottom).offset(35);
    }];

}


- (AllenMyMessageHeaderView *)headView{
    if (!_headView) {
        _headView = [[AllenMyMessageHeaderView alloc]init];
        __weak typeof (self) weakSelf = self;
        _headView.landingBlock = ^(){
            AllenLandingViewController *landingView =[[AllenLandingViewController alloc]init];
            [weakSelf.navigationController pushViewController:landingView animated:YES];
        
        };
    }
    return _headView;
}






- (AllenMyMessageTableView *)messageTable{
    if (!_messageTable) {
        _messageTable = [[AllenMyMessageTableView alloc]initWithFrame:CGRectMake(0, 0, 0, 0) style:(UITableViewStylePlain)];
        
    }
    return _messageTable;

}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
